const baseApi = 'http://120.79.42.137:8080/Entity/U1086186223a56e/HW3Team1/'
const baseFileApi = 'http://120.79.42.137:8080/file/U1086186223a56e/HW3Team1/'
const methods = { POST: 'post', GET: 'get', PUT: 'put', DELETE: 'delete' }

const UserApi = {
  login: { method: methods.GET, url: baseApi + 'User/' },
  getUserByUsername: { method: methods.GET, url: baseApi + 'User/' },
  getUserById: { method: methods.GET, url: baseApi + 'User/' },
  register: { method: methods.POST, url: baseApi + 'User/' },
  getAllUsers: { method: methods.GET, url: baseApi + 'User/' }
}

const UserInfoApi = {
  addUserInfo: { method: methods.POST, url: baseApi + 'Userinfo/' },
  getUserInfo: { method: methods.GET, url: baseApi + 'Userinfo/' }
}

const ShopApi = {
  getShopByUserId: { method: methods.GET, url: baseApi + 'Shop/' },
  getShopById: { method: methods.GET, url: baseApi + 'Shop/' },
  addShop: { method: methods.POST, url: baseApi + 'Shop/' },
  getShopsByName: { method: methods.GET, url: baseApi + 'Shop/' }
}

const ProductApi = {
  getProductsByShopId: { method: methods.GET, url: baseApi + 'Product/' },
  getProductsByName: { method: methods.GET, url: baseApi + 'Product/' },
  addProduct: { method: methods.POST, url: baseApi + 'Product/' },
  updateProduct: { method: methods.PUT, url: baseApi + 'Product/' }
}

const OrderApi = {
  getOrdersByReceiverId: { method: methods.GET, url: baseApi + 'Order/' },
  getOrdersBySenderId: { method: methods.GET, url: baseApi + 'Order/' },
  getOrdersByCourierId: { method: methods.GET, url: baseApi + 'Order/' },
  addOrder: { method: methods.POST, url: baseApi + 'Order/' },
  updateOrder: { method: methods.PUT, url: baseApi + 'Order/' },
  subscribeOrder: { url: baseApi + 'Order/' }
}

const OrderItemApi = {
  getOrderItemsByOrderId: { method: methods.GET, url: baseApi + 'Orderitem/' },
  addOrderItem: { method: methods.POST, url: baseApi + 'Orderitem/' }
}

const NotificationApi = {
  updateNotification: { method: methods.PUT, url: baseApi + 'Notification/' },
  addNotification: { method: methods.POST, url: baseApi + 'Notification/' },
  getNotification: { method: methods.GET, url: baseApi + 'Notification/' }
}

const PositionApi = {
  addPosition: { method: methods.POST, url: baseApi + 'Position/' },
  getPosition: { method: methods.GET, url: baseApi + 'Position/' }
}

const FileApi = {
  product: { postUrl: baseApi + 'Product/', getUrl: baseFileApi + 'Product/' }
}

export { UserApi, ShopApi, ProductApi, FileApi, OrderApi, OrderItemApi, NotificationApi, PositionApi, UserInfoApi }
